var datatable,qydatatable;
var colorpickerselect;
var selectedRowData,colorpicker
var qydata_value,kqdata_value;
var endDate,startDate
var ab=0
var select_data_cai='';
var datalist_table=[
    // {'datasource':'点云数据','dataname':'2022-07-01-L00251001','date':"2022-07-01"},
    {'datasource':'三维模型','dataname':'2022-07-01-L000swmx1','date':"2022-07-01"},
    {'datasource':'三维模型','dataname':'2022-07-01-L000swmx2','date':"2022-07-01"},
    {'datasource':'地下管线','dataname':'2022-07-01-L000dxgx1','date':"2022-07-01"},
    {'datasource':'地下管线','dataname':'2022-07-01-L000dxgx2','date':"2022-07-01"},
    {'datasource':'矢量图层','dataname':'2022-07-01-贺矿DWG','date':"2022-07-01"}
]

var qydatalist_table=[
    {'category':'监控监测','id':'一号矿区','username':'矿区全局','name':'S-01','url':''},
    {'category':'监控监测','id':'一号矿区','username':'矿区全局','name':'S-02','url':''},
    {'category':'监控监测','id':'一号矿区','username':'矿区全局','name':'S-03','url':''},
    {'category':'监控监测','id':'一号矿区','username':'矿区全局','name':'S-04','url':''},
    {'category':'监控监测','id':'一号矿区','username':'矿区全局','name':'S-05','url':''},
    {'category':'监控监测','id':'一号矿区','username':'矿区全局','name':'S-06','url':''},
    {'category':'边坡监测','id':'一号矿区','username':'矿区全局','name':'一号边坡','url':''},
    // {'category':'三维模型','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L000swmx1','url':''},
    // {'category':'三维模型','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L000swmx2','url':''},
    {'category':'地下管线','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L000dxgx1','url':''},
    {'category':'地下管线','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L000dxgx2','url':''},
    // {'category':'矢量图层','id':'一号矿区','username':'矿区全局','name':'2022-07-01-贺矿DWG','url':''},
    // {'category':'点云数据','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L00251001','url':''},
    // {'category':'采剥量','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L00251001','url':''},
    // {'category':'采剥量','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L00251002','url':''},
    {'category':'不动产信息','id':'一号矿区','username':'办公区','name':'办公楼','url':''},
    {'category':'不动产信息','id':'一号矿区','username':'居住区','name':'住宿楼','url':''},
    {'category':'不动产信息','id':'一号矿区','username':'设备区','name':'穿孔机','url':''},
    {'category':'不动产信息','id':'一号矿区','username':'设备区','name':'脱水机械','url':''},
    {'category':'属性文件','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L000dwg1','url':''},
    {'category':'属性文件','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L000shp2','url':''},
    {'category':'属性文件','id':'一号矿区','username':'矿区全局','name':'2022-07-01-L000dxf3','url':''}
    // {'category':'DWG文件','id':'一号矿区','username':'矿区全局','name':'2022-07-01-贺矿DWG'}
]

// var datalist_table=[]
// var qydatalist_table=[]
var qydatalist_screenid=[];//id数据
var qydatalist_screenusername=[];//name数据
var last_data=[]//最后需要展示的数据
var datalist_screen=[]
var juanliandata=[]//卷帘数据时间

function visible(){
        $("#dataselecr_id").css("left","10.5%")
        $("#dataselecr_id").css("top","65px")
}

//修改json颜色
function setDataSourceColor(dataSource, color) {
    console.log(color)
    console.log(Cesium.Color.fromCssColorString(color))
    let entities = dataSource.entities.values;
    entities.forEach(function (entity) {
        let cesiumColor = Cesium.Color.fromCssColorString(color);

        console.log(cesiumColor)
        if (entity.billboard) {
            entity.billboard.pixelOffset = new Cesium.Cartesian2(0, -5);
        } else if (entity.polyline) {

            entity.polyline.material = cesiumColor;
        } else if (entity.polygon) {
            entity.polygon.material = cesiumColor;
            entity.polygon.outlineColor = Cesium.Color.LIGHTSKYBLUE;
            entity.polygon.outlineWidth = 2.0;
            entity.polygon.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
        }
    })


}


$(document).ready(function() {
    $('#select_data_caiboliang').click(()=>{
        console.log($('#pre_file').val())
        if (select_data_cai==''){
            layer.msg('请选择数据');
        }else {
           if ($('#catname').text()=='采剥前文件'){
               $('#pre_file').val(select_data_cai)
               select_data_cai=''
               $('#dataselecr_id').hide()
               $('#select_data_caiboliang').hide()
               $('#find_data_caiboliang').css('margin-left','35%')
               adata=0
           }else if ($('#catname').text()=='采剥后文件'){
               if (select_data_cai== $('#pre_file').val()){
                   layer.msg('请选择不同数据');
                   select_data_cai=''
               }else {
                   $('#post_file').val(select_data_cai)
                   select_data_cai=''
                   $('#dataselecr_id').hide()
                   adata=0
                   $('#select_data_caiboliang').hide()
                   $('#find_data_caiboliang').css('margin-left','35%')
               }

           }else if ($('#catname').text()=='DWG文件'){
               if (select_data_cai==''){
                   layer.msg('请选择不同数据');
                   select_data_cai=''
               }else {
                   $('#pre_file_yunju').val(select_data_cai)
                   select_data_cai=''
                   $('#dataselecr_id').hide()
                   adata=0
                   $('#select_data_caiboliang').hide()
                   $('#find_data_caiboliang').css('margin-left','35%')
               }
           }else if ($('#catname').text()=='车辆轨迹数据'){
               if (select_data_cai==''){
                   layer.msg('请选择数据');
                   select_data_cai=''
               }else {
                   $('#pre_file_biaoduan').val(select_data_cai)
                   select_data_cai=''
                   $('#dataselecr_id').hide()
                   adata=0
                   $('#select_data_caiboliang').hide()
                   $('#find_data_caiboliang').css('margin-left','35%')
               }
           }



        }
    })


    $('#closed_RsAlldata').click(function (){
        $('#RsAlldata').hide()
        $(".iconclick").css("transform", "rotate(0deg)");
        ab=0
    })
    $('.iconclick').click(()=>{
        if (ab==0){
            $('#RsAlldata').show()
            ab=1
            $(".iconclick").css("transform", "rotate(180deg)");
        }else {
            $('#RsAlldata').hide()
            $(".iconclick").css("transform", "rotate(0deg)");
            ab=0
        }

    })

    $('#refresh_icon').click(function() {
        $('#demo2').prop('value', '');
        $('#test10').prop('value', '');
        if ($('#demo2').val() === '') {
            $('#demo2').attr('placeholder', '请选择数据源');
        }

        if ($('#test10').val() === '') {
            $('#test10').attr('placeholder', '请选择时间');
        }
        datatable=table.render({
            elem: '#data_table'
            ,data: datalist_table
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            // ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
            //     title: '提示'
            //     ,layEvent: 'LAYTABLE_TIPS'
            //     ,icon: 'layui-icon-tips'
            // }]
            ,cols: [[
                {field:'dataname', width:214, title: '名称'}
                ,{field:'datasource', width:160, title: '数据源', sort: true}

                ,{fixed: 'right', title:'操作', width:178, align:'center', toolbar: '#barDemo'}
            ]]
            ,page: {
                theme:"#0D2644",
                layout:[ 'page', 'next','count','skip']}
            ,limit: 4 // 每页显示10行数据
        });
    });
});

layui.use(['table', 'colorpicker'], function(){
    var table = layui.table;
     colorpicker = layui.colorpicker;
    selectedRowData;
    colorpicker.render({
        elem: '#color_select', // 颜色选择器绑定的元素ID
        done: function(color){
            console.log('选择的颜色：', color);
        }
    });

    datatable=table.render({
        elem: '#data_table'
        ,data: datalist_table
        ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
            title: '提示'
            ,layEvent: 'LAYTABLE_TIPS'
            ,icon: 'layui-icon-tips'
        }]
        ,cols: [[
            {field:'dataname', width:214, title: '名称'}
            ,{field:'datasource', width:160, title: '数据源', sort: true}

            ,{fixed: 'right', title:'操作', width:178, align:'center', toolbar: '#barDemo'}
        ]]
        ,page: {
            theme:"#0D2644",
            layout:[ 'page', 'next','count','skip'],
        }
        ,limit: 4 // 每页显示10行数据
    });

    qydatatable=table.render({
        elem: '#qydata_table'
        ,data: qydatalist_table
        ,cols: [[
            {type:'checkbox'}
            //,{field:'sxt', width:120, title: '类别'}
            ,{field:'name', width:119, title: '名称', sort: true}
            ,{field:'id', width:120, title: '矿区', sort: true}
            ,{field:'username', width:100, title: '区域'}


        ]]
        ,page: true
        ,done: function(res, curr, count){
        // 表格渲染完成后的回调函数
        // 绑定复选框点击事件
        table.on('checkbox(test)', function(obj){
            // console.log(obj.checked); // 当前复选框的选中状态，true或false
            // console.log(obj.data.name); // 当前行的相关数据
            // console.log('obj.type',obj.type); // 事件类型，如果是全选，则为all，如果是单选，则为one
            //sxt_flyto(obj.data.name)
            //console.log('1'+obj.data.name.slice(2))
           if ( obj.type=='one'){
               if (obj.checked ){
                   window.tilesets_SXT_Group.forEach((item,index)=>{
                       if (item._id=='1'+obj.data.name.slice(2)) {
                           item.show = true;
                           viewer.flyTo(item);
                       }
                   })
               }else {
                   window.tilesets_SXT_Group.forEach((item,index)=>{
                       if (item._id=='1'+obj.data.name.slice(2)) {
                           item.show=false;
                           viewer.flyTo(item);
                       }

                   })
               }
           }else {
               if (obj.checked){
                   window.tilesets_SXT_Group.forEach((item,index)=>{
                       item.show=true;
                   })
                   viewer.camera.flyTo({
                       destination: Cesium.Cartesian3.fromDegrees(119.12981248807075, 45.92899648373316, 7900)
                   });
               }else {
                   window.tilesets_SXT_Group.forEach((item,index)=>{
                       item.show=false;
                   })
               }

           }


        });
    }
    });



   console.log("datatable",datatable.config.data)
    //监听行工具事件
    table.on('tool(data_table)', function(obj){
        var data = obj.data;

        if(obj.event === 'right_data'){
            // layer.confirm('真的删除行么', function(index){
            //     obj.del();
            //     layer.close(index);
            // });
            let  quizy_right=$('#quizy').val();
            let  quizz_left=$('#quizz').val();
            if (obj.data.dataname==quizz_left){
                layer.msg('该数据已被左侧选择');
            }else {
                $('#quizy').val(obj.data.dataname)
            }
            console.log("obj",obj)
        } else if(obj.event === 'left_data'){
            let  quizy_right=$('#quizy').val();
            if (obj.data.dataname==quizy_right){
                layer.msg('该数据已被右侧选择');
            }else {
                $('#quizz').val(obj.data.dataname)
            }

        }
    });
});

layui.use('slider', function(){
    var $ = layui.$
        ,slider = layui.slider;

    slider.render({
        elem: '#slideTest14'
        ,value: 0
        ,min:-90
        ,max:90
        ,input: true //输入框
        ,theme: '#1E9FFF' //主题色
        ,type: 'vertical' //垂直滑块
        ,change: function(value) {
            // 在滑块渲染完成后修改样式
            console.log(value)
            var camera = viewer.camera;

            var cameraPosition = camera.position;

            var ellipsoid = viewer.scene.globe.ellipsoid;
            var cartographic = ellipsoid.cartesianToCartographic(cameraPosition);
            var longitude = Cesium.Math.toDegrees(cartographic.longitude);
            var latitude = Cesium.Math.toDegrees(cartographic.latitude);
            var height = cartographic.height;
            viewer.camera.setView({
                destination: Cesium.Cartesian3.fromDegrees(longitude, latitude, height),	//相机（眼睛）位置  不是地图位置
                //相机的姿态
                orientation: {
                    heading: Cesium.Math.toRadians(120), // 朝向
                    pitch: Cesium.Math.toRadians(value),    // 俯仰 0°表示的是水平 -90°表示的是垂直向下 +90°表示的是垂直向上
                    roll: 0.0                            //滚转
                }
            });

            // $('#slideTest14 .slider').css('background-color', '#1E9FFF');
        }

    });
   })

layui.use(['laydate','dropdown','slider'], function(){
    var laydate = layui.laydate;
    var dropdown = layui.dropdown;
    var slider=layui.slider;
    //日期时间范围
    laydate.render({
        elem: '#test10'
        ,type: 'datetime'
        ,range: true
        ,done: function(value, date){
            // 选择日期后的处理函数
            var dates = value.split(' - ');
             startDate = dates[0];
             endDate = dates[1];
            console.log('前一个日期：', startDate);
            console.log('后一个日期：', endDate);
            if ($("#demo2").val()==''){
                if ($("#test10").val()==''){
                    juanliandata=[]
                    juanliandata= datalist_table
                }else {
                    juanliandata=[]
                    datalist_table.forEach((item,index)=>{
                        if (new Date(startDate).getTime()<= new Date(item.date) &&new Date(item.date) <=new Date(endDate).getTime()){
                            juanliandata.push(item)
                        }
                    })
                }
            }else {
                if ($("#test10").val()==''){
                    juanliandata=[]
                    juanliandata= datalist_screen
                }else {
                    juanliandata=[]
                    datalist_screen.forEach((item,index)=>{
                        if (new Date(startDate).getTime()<= new Date(item.date) &&new Date(item.date) <=new Date(endDate).getTime()){
                            juanliandata.push(item)
                        }
                    })
                }
            }
            datatable=table.render({
                elem: '#data_table'
                ,data: juanliandata
                ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                    title: '提示'
                    ,layEvent: 'LAYTABLE_TIPS'
                    ,icon: 'layui-icon-tips'
                }]
                ,cols: [[
                     {field:'dataname', width:214, title: '名称'}
                    ,{field:'datasource', width:160, title: '数据源', sort: true}

                    ,{fixed: 'right', title:'操作', width:178, align:'center', toolbar: '#barDemo'}
                ]]
                ,page: {
                    theme:"#0D2644",
                    layout:[ 'page', 'next','count','skip']}
                ,limit: 4 // 每页显示10行数据
            });


        },
    });

    //矿区绑定输入框
    dropdown.render({
        elem: '#kqdata'
        ,data: [{
            title: '全部矿区'
            ,id: 101
        },{
            title: '一号矿区'
            ,id: 102
        },{
            title: '二号矿区'
            ,id: 103
        },{
            title: '三号矿区'
            ,id: 104
        },{
            title: '四号矿区'
            ,id: 105
        }]
        ,click: function(obj){
            this.elem.val(obj.title);
            $('#kqdata').val(obj.title)

        }
        ,style: 'width: 235px;'
    });

    //区域 绑定输入框
    dropdown.render({
        elem: '#qydata'
        ,data: [{
            title: '矿区全局'
            ,id: 101
        },{
            title: '办公区'
            ,id: 102
        },{
            title: '居住区'
            ,id: 103
        },{
            title: '设备区'
            ,id: 104
        },{
            title: '采矿区'
            ,id: 105
        },{
            title: '加工区'
            ,id: 106
        }]
        ,click: function(obj){
            this.elem.val(obj.title);
            $('#qydata').val(obj.title)

        }
        ,style: 'width: 235px;'
    });

    //数据源绑定输入框
    dropdown.render({
        elem: '#demo2'
        ,data: [{
            title: '点云数据'
            ,id: 101
        },{
            title: '三维模型'
            ,id: 102
        },{
            title: '地下管线'
            ,id: 103
        },{
            title: '矢量图层'
            ,id: 104
        }]
        ,click: function(obj){
            this.elem.val(obj.title);
            if ($("#demo2").val()==''){
                juanliandata=[]
                if (startDate!=''){
                    datalist_table.forEach((item,index)=>{
                        if (new Date(startDate).getTime()<= new Date(item.date) &&new Date(item.date) <=new Date(endDate).getTime()){
                            juanliandata.push(item)
                        }
                    })
                }else {
                    juanliandata=datalist_table
                }
                datatable=table.render({
                    elem: '#data_table'
                    ,data: juanliandata
                    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                    ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                        title: '提示'
                        ,layEvent: 'LAYTABLE_TIPS'
                        ,icon: 'layui-icon-tips'
                    }]
                    ,cols: [[
                        {field:'dataname', width:214, title: '名称'}
                        ,{field:'datasource', width:160, title: '数据源', sort: true}

                        ,{fixed: 'right', title:'操作', width:178, align:'center', toolbar: '#barDemo'}
                    ]]
                    ,page: {
                        theme:"#0D2644",
                        layout:[ 'page', 'next','count','skip']}
                    ,limit: 4 // 每页显示10行数据
                });
            }else {

                if ($("#test10").val()==''){
                    if ($("#demo2").val()=='点云数据'){
                        datalist_screen=[]
                        datalist_table.forEach((item,index)=>{
                            if (item.datasource=='点云数据'){
                                datalist_screen.push(item)
                            }
                        })
                    }else if ($("#demo2").val()=='三维模型'){
                        datalist_screen=[]
                        datalist_table.forEach((item,index)=>{
                            if (item.datasource=='三维模型'){
                                datalist_screen.push(item)
                            }
                        })
                    }else if ($("#demo2").val()=='矢量图层'){
                        datalist_screen=[]
                        datalist_table.forEach((item,index)=>{
                            if (item.datasource=='矢量图层'){
                                datalist_screen.push(item)
                            }
                        })
                    }else if ($("#demo2").val()=='地下管线'){
                        datalist_screen=[]
                        datalist_table.forEach((item,index)=>{
                            if (item.datasource=='地下管线'){
                                datalist_screen.push(item)
                            }
                        })
                    }
                    datatable=table.render({
                        elem: '#data_table'
                        ,data: datalist_screen
                        ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                        ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                            title: '提示'
                            ,layEvent: 'LAYTABLE_TIPS'
                            ,icon: 'layui-icon-tips'
                        }]
                        ,cols: [[
                           {field:'dataname', width:214, title: '名称'}
                            ,{field:'datasource', width:160, title: '数据源', sort: true}

                            ,{fixed: 'right', title:'操作', width:178, align:'center', toolbar: '#barDemo'}
                        ]]
                        ,page: {
                            theme:"#0D2644",
                            layout:[ 'page', 'next','count','skip']}
                        ,limit: 4 // 每页显示10行数据
                    });
                }else {
                    juanliandata=[]
                    if (startDate!=''){
                        datalist_table.forEach((item,index)=>{
                            if (new Date(startDate).getTime()<= new Date(item.date) &&new Date(item.date) <=new Date(endDate).getTime()){
                                juanliandata.push(item)
                            }
                        })
                    }else {
                        juanliandata=datalist_table
                    }
                    if ($("#demo2").val()=='点云数据'){

                        datalist_screen=[]
                        juanliandata.forEach((item,index)=>{
                            if (item.datasource=='点云数据'){
                                datalist_screen.push(item)
                            }
                        })
                }else if ($("#demo2").val()=='三维模型'){
                        datalist_screen=[]
                        juanliandata.forEach((item,index)=>{
                            if (item.datasource=='三维模型'){
                                datalist_screen.push(item)
                            }
                        })
                    }else if ($("#demo2").val()=='矢量图层'){
                        datalist_screen=[]
                        juanliandata.forEach((item,index)=>{
                            if (item.datasource=='矢量图层'){
                                datalist_screen.push(item)
                            }
                        })
                    }else if ($("#demo2").val()=='地下管线'){
                        datalist_screen=[]
                        juanliandata.forEach((item,index)=>{
                            if (item.datasource=='地下管线'){
                                datalist_screen.push(item)
                            }
                        })
                    }
                    datatable=table.render({
                        elem: '#data_table'
                        ,data: datalist_screen
                        ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                        ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
                            title: '提示'
                            ,layEvent: 'LAYTABLE_TIPS'
                            ,icon: 'layui-icon-tips'
                        }]
                        ,cols: [[
                            {field:'dataname', width:214, title: '名称'}
                            ,{field:'datasource', width:160, title: '数据源', sort: true}

                            ,{fixed: 'right', title:'操作', width:178, align:'center', toolbar: '#barDemo'}
                        ]]
                        ,page: {
                            theme:"#0D2644",
                            layout:[ 'page', 'next','count','skip']}
                        ,limit: 4 // 每页显示10行数据
                    });

                }
            }
            }
        ,style: 'width: 235px;'
    });
})
function getRealEstateData(){
    var requestData = {
        requirParameterD:{
            //设备类型
            types:'',
            //设备名称
            name:'',
            //采购日期
            purchase:'',
            //建筑物楼高
            servicelife:'',
            //建筑面积/平方米
            status:'',
        },
        requirParameterB:{
            //id
            id:'',
            //建筑物名称/办公楼/宿舍楼
            buildingname:'',
            //建筑物类型
            buildingtype:'',
            //建筑物楼高
            buildinglevel:'',
            //建筑面积/平方米
            buildingarea:'',
            //占地面积/平方米
            buildingfloorarea:'',
            //备注
            memo:'',
        }
    }
    // var url='http://127.0.0.1:8282/kuangqu/tbuilding/listByCondition';
    var url='http://3510b38g11.zicp.fun:13894/kuangqu/tbuilding/listByCondition';
    $.ajax({
        type: 'POST',
        headers: {
            Authorization:localTokenData
        },
        data: JSON.stringify(requestData),
        // url: 'http://192.168.0.108:8282/kuangqu/sys/user/login',  //后台地址注意要改
        url: 'http://127.0.0.1:8282/kuangqu/tbuilding/listByConditio',  //后台地址注意要改
        //url:url,
        contentType: "application/json",
        success: function (res) {

            dataList=res.data.device;
            console.log("dataList",dataList)
            addRealEstateDataTable(dataList)
            // addTable(dataList)
            removeMarkers()
            // historyTable(dataList)
            // //添加图标

            dataList.forEach(function (item) {
                addBuildMarker(item, 'images/位置.png', 35,60,70,'icon_device')
            });
        }
    })
}
let markDIdNum = 1
let psMarkerDIdList = []
function addBuildMarker(location, markTypeUrl, markHeight, width, height,icon_type) {

    let enetity = {}
    enetity = viewer.entities.add({
        id: location.id,
        dataInfo:location,
        _type: icon_type,
        position: Cesium.Cartesian3.fromDegrees(location.longitude, location.latitude, markHeight), //经纬度与高度
        billboard: {
            image: markTypeUrl,
            width: width,
            height: height,
            horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
            verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
            scale: 0.5,
            heightReference:Cesium.HeightReference.CLAMP_TO_GROUND,
            clampToGround:true , //是否贴地

            //heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            disableDepthTestDistance: Number.POSITIVE_INFINITY,
            // sizeInMeters: true, //随比例缩放开启
        },
        label : {
            text : location.name,
            font : '16px sans-serif',
            fillColor : Cesium.Color.WHITE,
            outlineColor : Cesium.Color.BLACK,
            outlineWidth : 1,
            style : Cesium.LabelStyle.FILL_AND_OUTLINE,
            verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
            pixelOffset : new Cesium.Cartesian2(0, -50),
            heightReference:Cesium.HeightReference.CLAMP_TO_GROUND,
            clampToGround:true , //是否贴地
            //heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            disableDepthTestDistance: Number.POSITIVE_INFINITY,
        },
    })
    psMarkerDIdList.push(enetity.id)
    markDIdNum++;
}

function addRealEstateDataTable(dataList){
    table.render({
        elem: '#qydata_table'
        ,data: dataList
        ,cols: [[
            // {type:'radio'}
            //,{field:'sxt', width:120, title: '类别'}
            ,{field:'types', width:86, title: '设备类型'}
            ,{field:'name', width:100, title: '设备名称'}
            ,{field:'purchase', width:163, title: '采购日期'}
            ,{field:'servicelife', width:100, title: '使用寿命(年)'}
            ,{field:'status', width:120, title: '设备状态'}
            //,{fixed: 'right', title:'颜色', width:86, align:'center', toolbar: '#barDemo1'}
        ]]
        ,page: true
        ,done: function(res, curr, count){
            table.on('row(test)', function(obj){
                console.log(obj)
                var data = obj.data;
                var entity = viewer.entities.getById(data.id);
                viewer.flyTo(entity);
            });
        }
    });
}


function show_dataselect(){

    var RealEstateData=[];
    var pd=$("#catname").text()
    if(pd=='不动产信息'){
        getRealEstateData();
    }

    qydatatable=[]
    var ssdata_value=$('#ssdata').val()//搜索
    qydatalist_screenid=[]
    qydatalist_screenusername=[]
    last_data=[]

    kqdata_value=$('#kqdata').val()
    qydata_value=$('#qydata').val()
    if (kqdata_value==''){
        layer.msg('请选择矿区！');
        return
    }
    if (qydata_value==''){
        layer.msg('请选择区域！');
        return
    }

    qydatalist_table.forEach((item,index)=>{
        if (item.id==kqdata_value){
            qydatalist_screenid.push(item)
        }else if(kqdata_value=="全部矿区") {
            qydatalist_screenid.push(item)
        }
    })

    qydatalist_screenid.forEach((item,index)=>{
        if (qydata_value==item.username &&qydata_value!='矿区全局'){
            qydatalist_screenusername.push(item)
        }else if(qydata_value=='矿区全局'){
            qydatalist_screenusername.push(item)
        }
    })

    if (pd=="采剥前文件"||pd=="采剥后文件"){
        pd="采剥量"
    }
    qydatalist_screenusername.forEach((item,index)=>{
            if (item.category==pd){
                if (ssdata_value==''){
                    last_data.push(item)
                }else if (item.name.indexOf(ssdata_value)!=-1){
                    last_data.push(item)
                }
            }
        })

        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'checkbox'}
                ,{field:'name', width:125, title: '名称', sort: true}
                ,{field:'id', width:120, title: '矿区', sort: true}
                ,{field:'username', width:114, title: '区域'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                // 表格渲染完成后的回调函数
                // 绑定复选框点击事件
                table.on('checkbox(test)', function(obj){
                    // console.log(obj.checked); // 当前复选框的选中状态，true或false
                    //console.log(obj.data); // 当前行的相关数据
                    // console.log('obj.type',obj.type); // 事件类型，如果是全选，则为all，如果是单选，则为one
                    //sxt_flyto(obj.data.name)
                    //console.log('1'+obj.data.name.slice(2))
                   if (pd=='监控监测'){
                       if ( obj.type=='one'){
                           if (obj.checked ){
                               window.tilesets_SXT_Group.forEach((item,index)=>{
                                   if (item._id=='1'+obj.data.name.slice(2)) {
                                       item.show = true;
                                       viewer.flyTo(item);
                                   }
                               })
                           }else {
                               window.tilesets_SXT_Group.forEach((item,index)=>{
                                   if (item._id=='1'+obj.data.name.slice(2)) {
                                       item.show=false;
                                       viewer.flyTo(item);
                                   }

                               })
                           }
                       }else {
                           if (obj.checked){
                               last_data.forEach((item,index)=>{
                                   window.tilesets_SXT_Group.forEach((item1,index)=>{
                                       if (item1._id=='1'+item.name.slice(2)) {
                                           item1.show=true;
                                       }

                                   })

                               })
                               viewer.camera.flyTo({
                                   destination: Cesium.Cartesian3.fromDegrees(119.12981248807075, 45.92899648373316, 7900)
                               });
                           }else {
                               window.tilesets_SXT_Group.forEach((item,index)=>{
                                   item.show=false;
                               })
                           }

                       }
                   }
                   else if (pd=='边坡监测'){
                          if (obj.type=='one'){
                              if (obj.checked){
                                  window.tilesets_WL_Group.forEach((item,index)=>{
                                      if (obj.data.name==item.name){
                                         item.show=true
                                         viewer.flyTo(item);
                                     }
                                  })
                                  window.WlPoint_Group.forEach((item,index)=>{
                                      if(item.description._value.search(obj.data.name)!=-1){
                                          item.show=true;
                                      }else{
                                          item.show=false;
                                      }
                                  })
                              }else {
                                  window.tilesets_WL_Group.forEach((item,index)=>{
                                      item.show=false
                                  })
                                  window.WlPoint_Group.forEach((item,index)=>{
                                      item.show=false;
                                  })
                              }
                          } else {
                              if (obj.checked){
                                  window.tilesets_WL_Group.forEach((item,index)=>{
                                      if (obj.data.name==item.name){
                                          item.show=true
                                          viewer.flyTo(item);
                                      }
                                  })
                                  window.WlPoint_Group.forEach((item,index)=>{
                                      if(item.description._value.search(obj.data.name)!=-1){
                                          item.show=true;
                                      }else{
                                          item.show=false;
                                      }
                                  })
                              }else {
                                  window.tilesets_WL_Group.forEach((item,index)=>{
                                      item.show=false
                                  })
                                  window.WlPoint_Group.forEach((item,index)=>{
                                      item.show=true;
                                  })
                              }
                          }

                   }
                   else if (pd=='三维模型'){
                     if (obj.type=='one'){
                         if (obj.checked){
                             window.tilesets_QX_Group.forEach((item, index) => {
                                 if (item.name==obj.data.name) {
                                     console.log(item)
                                     item.show = true;
                                     viewer.flyTo(item)
                                     // false_flyto();
                                 }
                             })
                         }else {
                             window.tilesets_QX_Group.forEach((item, index) => {
                                 if (item.name==obj.data.name) {
                                     item.show = false;
                                 }
                             })
                         }
                     }else {
                         if (obj.checked){
                             window.tilesets_QX_Group.forEach((item, index) => {
                                     item.show = true;
                                     false_flyto();
                             })
                         }else {
                             window.tilesets_QX_Group.forEach((item, index) => {
                                     item.show = false;
                             })
                         }
                     }
                   }
                });
            }
        });

    if (pd=='点云数据'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'checkbox'}
                //,{field:'sxt', width:120, title: '类别'}
                ,{field:'name', width:136, title: '名称', sort: true}
                ,{field:'id', width:86, title: '矿区', sort: true}
                ,{field:'username', width:86, title: '区域'}
                ,{fixed: 'right', title:'颜色', width:116, align:'center', toolbar: '#barDemo1'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                // 表格渲染完成后的回调函数
                // 绑定复选框点击事件
                table.on('checkbox(test)', function(obj){
                    if ( obj.type=='one'){
                        if (obj.checked ){
                            console.log(window.tilesets_DY_Group)
                            window.tilesets_DY_Group.forEach((item, index) => {
                                if (item.name==obj.data.name) {
                                    console.log(obj.data.name+'======='+item.name)
                                    item.show = true;
                                    viewer.flyTo(item);
                                }
                            })
                        }else {
                            window.tilesets_DY_Group.forEach((item, index) => {
                                if (item.name==obj.data.name) {
                                    item.show = false;
                                    viewer.flyTo(item);
                                }
                            })
                        }
                    }else {
                        if (obj.checked){
                            var dy1name='当前复选框的选中状态';
                            if (obj.data.name=='2022-07-01-L00251001'){
                                dy1name='8y3dtiles'
                            }
                            window.tilesets_DY_Group.forEach((item,index)=>{
                                // if (item._url.search(dy1name) != -1) {
                                    item.show = true;
                                    viewer.flyTo(item);
                                // }
                                })

                        }else {
                            var dy1name='当前复选框的选中状态';
                            if (obj.data.name=='2022-07-01-L00251001'){
                                dy1name='8y3dtiles'
                            }
                            window.tilesets_DY_Group.forEach((item, index) => {
                                // if (item._url.search(dy1name) != -1) {
                                    item.show = false;
                                    viewer.flyTo(item);
                                // }
                            })
                        }

                    }


                });
                table.on('tool(test)', function(obj){
                    var data = obj.data;
                    var dyname="初始化颜色选择器"
                    if (data.name=='2022-07-01-L00251001'){
                         dyname="8y3dtiles"
                    }else {
                         dyname="初始化颜色选择器"
                    }
                    layer.open({
                        type: 1,
                        title: '颜色选择器',
                        content: '<div id="color_select" style="margin: 10px;background-color: white;left: 33%"></div>'
                    })
                    // 初始化颜色选择器
                    colorpicker.render({
                        elem: '#color_select', // 颜色选择器绑定的元素ID
                        done: function(color){
                            console.log('选择的颜色：', color);
                                // 这里可以根据选择的颜色执行其他相应的操作
                                change_color(color, obj.data.name);
                                var event = obj.event;
                                if (event === 'color_select') {
                                    // 获取最后一列的<a>标签元素
                                    var colorBtn = obj.tr.find('td:last-child() a');
                                    // 修改<a>标签的颜色
                                    colorBtn.css('background-color', color);
                                }

                                //$('#color_select').css('background-color', color);


                        }
                    });
                });
            }
        });
    }
    else if (pd=='地下管线'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'checkbox'}
                ,{field:'name', width:136, title: '名称', sort: true}
                //,{field:'sxt', width:120, title: '类别'}
                ,{field:'id', width:86, title: '矿区', sort: true}
                ,{field:'username', width:86, title: '区域'}

                ,{fixed: 'right', title:'颜色', width:80, align:'center', toolbar: '#barDemo1'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                // 表格渲染完成后的回调函数
                // 绑定复选框点击事件
                table.on('checkbox(test)', function(obj){

                    if ( obj.type=='one'){
                        if (obj.checked ){
                            window.tilesets_GX_Group.forEach((item, index) => {
                                if (item.name==obj.data.name) {
                                    item.show = true;
                                    viewer.flyTo(item);
                                    console.log()
                                    window.tilesets_QX_Group.forEach((item, index) => {
                                        item.style = new Cesium.Cesium3DTileStyle({
                                            color: "color('rgba(255,255,255,0.3)')",

                                        });
                                    })
                                }
                            })
                        }else {
                            window.tilesets_GX_Group.forEach((item, index) => {
                                if (item.name==obj.data.name) {
                                    item.show = false;
                                    viewer.flyTo(item);
                                    window.tilesets_QX_Group.forEach((item, index) => {
                                        item.style = new Cesium.Cesium3DTileStyle({
                                            color: "color('rgba(255,255,255,1)')",

                                        });
                                    })
                                }
                            })
                        }
                    }else {
                        if (obj.checked){
                            window.tilesets_GX_Group.forEach((item,index)=>{
                                    item.show = true;
                                    viewer.flyTo(item);
                                window.tilesets_QX_Group.forEach((item, index) => {
                                    item.style = new Cesium.Cesium3DTileStyle({
                                        color: "color('rgba(255,255,255,0.3)')",

                                    });
                                })

                            })

                        }else {
                            window.tilesets_GX_Group.forEach((item, index) => {
                                    item.show = false;
                                    viewer.flyTo(item);
                                window.tilesets_QX_Group.forEach((item, index) => {
                                    item.style = new Cesium.Cesium3DTileStyle({
                                        color: "color('rgba(255,255,255,1)')",

                                    });
                                })
                            })
                        }

                    }


                });
                table.on('tool(test)', function(obj){
                    var data = obj.data;
                    console.log('data',data)
                    var gxname=data.name

                    layer.open({
                        type: 1,
                        title: '颜色选择器',
                        content: '<div id="color_select" style="margin: 10px;background-color: white;left: 33%"></div>'
                    })
                    // 初始化颜色选择器
                    colorpicker.render({
                        elem: '#color_select', // 颜色选择器绑定的元素ID
                        done: function(color){
                            change_color(color, gxname);
                            var event = obj.event;
                            if (event === 'color_select') {
                                // 获取最后一列的<a>标签元素
                                var colorBtn = obj.tr.find('td:last-child() a');
                                // 修改<a>标签的颜色
                                colorBtn.css('background-color', color);
                            }


                        }
                    });

                });
            }
        });
    }
    else if (pd=='矢量图层'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'checkbox'}
                //,{field:'sxt', width:120, title: '类别'}
                ,{field:'name', width:136, title: '名称', sort: true}
                ,{field:'id', width:86, title: '矿区', sort: true}
                ,{field:'username', width:86, title: '区域'}

                ,{fixed: 'right', title:'颜色', width:86, align:'center', toolbar: '#barDemo1'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                // 表格渲染完成后的回调函数
                // 绑定复选框点击事件
                table.on('checkbox(test)', function(obj){
                    // console.log(obj.checked); // 当前复选框的选中状态，true或false
                    //console.log(obj.data); // 当前行的相关数据
                    // console.log('obj.type',obj.type); // 事件类型，如果是全选，则为all，如果是单选，则为one
                    //sxt_flyto(obj.data.name)
                    //console.log('1'+obj.data.name.slice(2))
                    var gxname=obj.data.name
                    if ( obj.type=='one'){
                        if (obj.checked ){
                            window.tilesets_DWG_Group.forEach((item, index) => {
                                console.log("======="+decodeURIComponent(item.name))
                                // item.show = false;
                                if (decodeURIComponent(item.name)==obj.data.name+"_reduce.geojson") {
                                    item.show = true;
                                    viewer.flyTo(item);
                                }
                            })
                        }else {
                            window.tilesets_DWG_Group.forEach((item, index) => {
                                console.log("======="+decodeURIComponent(item.name))
                                if (decodeURIComponent(item.name)==obj.data.name+"_reduce.geojson") {
                                    item.show = false;
                                    viewer.flyTo(item);
                                }
                            })
                        }
                    }else {
                        if (obj.checked){

                            var checkStatus = table.checkStatus('qydata_table')

                            // console.log("======="+1212121)
                            // console.log(checkStatus.data)

                            window.tilesets_DWG_Group.forEach((item,index)=>{
                                // item.show = false;
                                checkStatus.data.forEach((itemname,index)=>{
                                    // console.log(itemname.name)
                                    if (decodeURIComponent(item.name)==itemname.name+"_reduce.geojson") {
                                        item.show = true;
                                        viewer.flyTo(item);
                                    }
                                })
                                // item.show = true;
                                // viewer.flyTo(item);
                                // if (decodeURIComponent(item.name)==obj.data.name+"_reduce.geojson") {
                                //     item.show = true;
                                //     viewer.flyTo(item);
                                // }
                                })

                        }else {
                            window.tilesets_DWG_Group.forEach((item, index) => {
                                item.show = false;
                                viewer.flyTo(item);
                                if (decodeURIComponent(item.name)==obj.data.name+"_reduce.geojson") {
                                    console.log("======="+decodeURIComponent(item.name))
                                    item.show = false;
                                    viewer.flyTo(item);
                                }
                            })
                        }

                    }

                });
                table.on('tool(test)', function(obj){
                    var data = obj.data;
                    console.log('data',data)

                    var gxname=obj.data.name
                    // if (obj.data.name=='2022-07-01-贺矿DWG'){
                    //     gxname='hekuang2'
                    // }else {
                    //     gxname='颜色选择器'
                    // }
                    layer.open({
                        type: 1,
                        title: '颜色选择器',
                        content: '<div id="color_select" style="margin: 10px;background-color: white;left: 33%"></div>'
                    })
                    // 初始化颜色选择器
                    colorpicker.render({
                        elem: '#color_select', // 颜色选择器绑定的元素ID
                        done: function(color){

                            change_color(color, gxname);
                            var event = obj.event;
                            if (event === 'color_select') {
                                // 获取最后一列的<a>标签元素
                                var colorBtn = obj.tr.find('td:last-child() a');
                                // 修改<a>标签的颜色
                                colorBtn.css('background-color', color);
                            }


                        }
                    });

                });
            }
        });
    }
    else if(pd=='不动产信息'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'radio'}
                ,{field:'name', width:153, title: '名称', sort: true}
                //,{field:'sxt', width:120, title: '类别'}
                ,{field:'id', width:105, title: '矿区', sort: true}
                ,{field:'username', width:100, title: '区域'}

                //,{fixed: 'right', title:'颜色', width:86, align:'center', toolbar: '#barDemo1'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                table.on('radio(test)', function(obj){
                   console.log(obj)
                    if (obj.checked){
                        Sxcx_flyto1(obj.data.name)
                    }


                });
            }
        });
    }
    else if($("#catname").text()=='采剥前文件'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'radio'}
                ,{field:'name', width:153, title: '名称', sort: true}
                ,{field:'id', width:105, title: '矿区', sort: true}
                ,{field:'username', width:169, title: '区域'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                table.on('radio(test)', function(obj){
                    console.log(obj)
                    if (obj.checked){
                        if (obj.data.name!=$('#post_file').val()){
                            select_data_cai=obj.data.name
                            //$('#pre_file').val(obj.data.name)
                            $('#PostFile') .removeClass('layui-btn-disabled').prop('disabled', false);
                            window.tilesets_DY_Group.forEach((item, index) => {
                               if (item.name==obj.data.name){
                                   item.show = true;
                                   viewer.flyTo(item);
                               }

                            })
                        }else {
                            select_data_cai=''
                            obj.checked = false;
                            layer.msg('两次文件相同');
                        }

                    }


                });
            }
        });
    }
    else if($("#catname").text()=='采剥后文件'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'radio'}
                ,{field:'name', width:153, title: '名称', sort: true}
                ,{field:'id', width:105, title: '矿区', sort: true}
                ,{field:'username', width:169, title: '区域'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                table.on('radio(test)', function(obj){
                    console.log(obj)
                    if (obj.checked){
                        if (obj.data.name!= $('#pre_file').val()){
                            select_data_cai=obj.data.name
                            //$('#post_file').val(obj.data.name)
                            window.tilesets_DY_Group.forEach((item, index) => {
                                if (item.name==obj.data.name){
                                    item.show = true;
                                    viewer.flyTo(item);
                                }
                            })

                        }else {
                            select_data_cai=''
                            obj.checked = false;
                            layer.msg('两次文件相同');
                        }

                    }


                });
            }
        });
    }
    else if($("#catname").text()=='DWG文件'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'radio'}
                ,{field:'name', width:155, title: '名称', sort: true}
                //,{field:'sxt', width:120, title: '类别'}
                ,{field:'id', width:105, title: '矿区', sort: true}
                ,{field:'username', width:100, title: '区域'}

                //,{fixed: 'right', title:'颜色', width:86, align:'center', toolbar: '#barDemo1'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                table.on('radio(test)', function(obj){
                    console.log(obj)
                    if (obj.checked){
                            //$('#pre_file_yunju').val(obj.data.name)
                            // window.tilesets_DWG_Group.forEach((item, index) => {
                            //     if (item._url.search('hekuang2') != -1) {
                            //         item.show = true;
                            //         viewer.flyTo(item);
                            //     }
                            // })
                            select_data_cai=obj.data.name
                            window.tilesets_DWG_Group.forEach((item, index) => {
                                console.log(item._url)
                                if (decodeURIComponent(item.name)==obj.data.name+"_reduce.geojson") {
                                     item.show = true;
                                    viewer.camera.flyTo({
                                        // destination: Cesium.Cartesian3.fromDegrees(119.122076872,45.933504747, 8000)
                                        destination: Cesium.Cartesian3.fromDegrees(119.122076872,45.933504747, 1000)
                                    });
                                    // viewer.flyTo(item);
                                }
                                // if (item.name==obj.data.name) {
                                //     item.show = true;
                                //     viewer.flyTo(item);
                                // }
                            })

                            $("#select_Area_yunju").css("display", 'none');
                            $('#PreFile_biaoduan').removeClass("layui-btn-disabled").attr("disabled", false);

                    }


                });
            }
        });
    }
    else if($("#catname").text()=='车辆轨迹数据'){
        qydatatable=table.render({
            elem: '#qydata_table'
            ,data: last_data
            ,cols: [[
                {type:'radio'}
                ,{field:'name', width:190, title: '名称', sort: true}
                //,{field:'sxt', width:120, title: '类别'}
                ,{field:'id', width:105, title: '矿区', sort: true}
                ,{field:'username', width:100, title: '区域'}

                //,{fixed: 'right', title:'颜色', width:86, align:'center', toolbar: '#barDemo1'}
            ]]
            ,page: true
            ,done: function(res, curr, count){
                table.on('radio(test)', function(obj){
                    console.log('obj',obj)
                    if (obj.checked){
                        console.log(obj.data.hight)
                            select_data_cai=obj.data.name
                        viewer.camera.flyTo({
                            destination: Cesium.Cartesian3.fromDegrees(obj.data.lon,obj.data.lat,obj.data.hight),
                            orientation: {
                                //range:500
                            }
                        });
                            //$('#pre_file_biaoduan').val(obj.data.name)
                            $("#select_Area_biaoduan").css("display", 'none');
                            $('#cal_yunju').removeClass("layui-btn-disabled").attr("disabled", false);



                    }


                });
            }
        });
    }

    $("#mytable_list").show();

}

//计算多边形面积
function polgyonArea(points) {
    var area = 0;
    for (let i = 0; i < points.length; i++) {
        let j = (i + 1) % points.length;
        area += points[i].x * points[j].y;
        area -= points[i].y * points[j].x;
    }
    area /= 2;
    return Math.abs(area);
}






$.ajax({
    url:  "http://127.0.0.1:8282/kuangqu/tlayer/listdataall",//"http://3510b38g11.zicp.fun:13894/kuangqu/tlayer/listdataall"
    type: 'post',
    // headers: {"authorization": token},
    dataType: 'json',
    contentType: "application/json",
    headers: {
        Authorization:localTokenData
    },
    data:JSON.stringify({}),
    success: function(data){
        // console.log("数据",data);
        data.data.forEach((item,index)=>{

            // console.log("数据",item);
            if (item.layertype=="倾斜影像"){
                var jsonlist=
                {'category':'三维模型','id':item.diggings,'username':item.region,'name':item.layername,'url':item.layerurl}

                qydatalist_table.push(jsonlist)
            }else if (item.layertype=="DWG" && item.layerbz=="1" ){

                var jsonlist1=
                    {'category':'DWG文件','id':item.diggings,'username':item.region,'name':item.layername,'url':item.layerurl}
                qydatalist_table.push(jsonlist1)
            }
            else if (item.layertype=="DWG" && item.layerbz=="0" ){
                var jsonlist=
                    {'category':'矢量图层','id':item.diggings,'username':item.region,'name':item.layername,'url':item.layerurl}
                qydatalist_table.push(jsonlist)
            }
            else if(item.layertype=="Shp"){
                var jsonlist=
                    {'category':'矢量图层','id':item.diggings,'username':item.region,'name':item.layername,'url':item.layerurl}
                qydatalist_table.push(jsonlist)
            }
            else if (item.layertype=="点云"){
                var jsonlist=
                    {'category':'点云数据','id':item.diggings,'username':item.region,'name':item.layername,'url':item.layerurl}
                 // add3dtileslayer_DY(item.layerurl)
                var caiboliangjson= {'category':'采剥量','id':item.diggings,'username':item.region,'name':item.layername,'url':item.layerurl}
                qydatalist_table.push(jsonlist)
                qydatalist_table.push(caiboliangjson)
            }
        })
    },
    error: function(xhr, textStatus, errorThrown){
        // 处理错误
        console.error(errorThrown);
    }
});

